const path = require("path");

module.exports = {
  publicPath: './',
  css: {
    loaderOptions: {
      stylus: {
        'resolve url': true,
        'import': [
          './src/theme'
        ]
      }
    }
  },
  pluginOptions: {
    'cube-ui': {
      postCompile: true,
      theme: true
    }
  },
  configureWebpack: function() {
    if (process.env.NODE_ENV === 'production') {
      return {
        // plugins: [
        //   new CompressionPlugin({
        //     test: /\.js$|\.html$|\.css$|\.jpg$|\.jpeg$|\.png/,
        //     threshold: 10240,
        //     deleteOriginalAssets: false
        //   })
        // ],
        resolve: {
          alias: {
            "@": path.resolve(__dirname, "./src")
          }
        }
      }
    } else {
      return {
        resolve: {
          alias: {
            "@": path.resolve(__dirname, "./src")
          }
        }
      }
    }
  },
  devServer: {
    proxy: {
      '/service': {
        target: 'https://www.amap.com',
        ws: true,
        changeOrigin: true
      },
      '/evisys': {
        target: 'http://218.108.93.156:6001',
        ws: true,
        changeOrigin: true
      },
      "/oss": {
        // target: "http://10.12.102.76:9090/oss",
        target: "http://61.164.53.62:9137/oss",
        changeOrigin: true,
        pathRewrite: {
          "^/oss": ""
        }
      },
    }
  }
}
